<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>从session中获取值</h1>
<span th:text="${session.get('data')}"></span><br/>
<span th:text="${#session.getAttribute('data')}"></span><br/>
<span th:text="${#httpSession.getAttribute('data')}"></span><br/>
<span th:text="${session.data}"></span><br/>

<script type="text/javascript" th:inline="javascript">
    //获取http://localhost:8080/springboot/user/detail

    //获取协议名称
    var schem =[[${#request.getScheme()}]]
    //alert(schem)

    //获取服务器的名称
    var serverName = [[${#request.getServerName}]]
    //alert(serverName)

    //获取端口号
    var serverPort = [[${#request.getServerPort}]]
   // alert(serverPort)

    //获取上线文根
    var contextPath = [[${#request.getContextPath() }]]
    //alert(contextPath)

    var allPath = schem + "://" + serverName + ":" + serverPort + contextPath;
    alert("allPath:"+ allPath)

    //完整的请求路径
    var requestURL = [[${#httpServletRequest.requestURL}]]
    alert("requestURL:" +requestURL)

    //请求参数
    var queryString =[[${#httpServletRequest.queryString}]]
    alert("queryString:"+queryString)
</script>
</body>
</html>